extends layout

block content
    script(type='text/javascript', src='./javascripts/timeout.js')
    script(type='text/javascript', src='./javascripts/jquery-1.10.2.min.js')
    script(type='text/javascript', src='./javascripts/admin.js')
    #mainContentPain

        #banner
            img(src='./images/battleship.jpg')
        include userbar
        #display
            h3 Schedule matches and view a list of users!
            include message
            form(method="post")

                input(type="submit", name="postCommand", value="Show List of Users")
                input(type="button", name="postCommand", value="Hide Info", onclick="location=href='/admin'")
                input(type="submit", value="Admin Edit Details", name="postCommand")
                input(type="button", value="Start a Game", id="startGameButton")
                input(type="button", value="Stop a Game", id="stopGameButton")

                br
                p Please note that the details that are to be changed must be manually entered...
                label.formlabel Name to edit:
                input(type="text", name="editThis", class="formInput")

                label.formlabel Username:
                input(type="text", name="userName", class="formInput")

                label.formlabel Password:
                input(type="password", name="password", class="formInput")

                label.formlabel Email:
                input(type="email", name="email", class="formInput")

                label.formlabel Is online:
                input(type="number", name="isOnline", class="formInput")

                label.formlabel Is admin:
                input(type="number", name="isAdmin", class="formInput")

            #usersTable

                - for (var id in database) {
                    - var name = database[id].userName
                    - var password = database[id].password
                    - var email = database[id].email
                    - var joinDate = database[id].joinDate
                    - var isLoggedIn = database[id].onlineState
                    - var isAdmin = database[id].isAdmin

                        table
                            tbody
                                tr
                                    td
                                        label User Name:
                                    td.tableUsername #{name}
                                tr
                                    td
                                        label Password:
                                    td #{password}
                                tr
                                    td
                                        label Email:
                                    td #{email}
                                tr
                                    td
                                        label Login Status:
                                    td.onlineState
                                        - if(isLoggedIn == 0) {
                                            | Offline
                                        - } else if(isLoggedIn == 1) {
                                            | Online (Desktop)
                                        - } else {
                                            | Online (Mobile)
                                        - }
                                tr
                                    td
                                        label Is admin:
                                    td
                                        if isAdmin
                                            | True
                                        else
                                            | False
                                tr
                                    td
                                        label Join date:
                                    td #{joinDate}
                    - }
            br
            hr
        include footer
        hr
